// 加载包
const express = require('express')
const fansmiddleware = require('../controllers/fans')
const tokenverify = require('../middleware/tokenverify')

const router = express.Router()

// 获取当前用户粉丝列表
router.get(
  '/',
  // tokenverify, //token验证
  fansmiddleware.getFansList
)

// 更改关注状态
router.patch(
  '/attentionStatus',
  tokenverify, // token验证,
  (req, res, next) => {
    const { attentionStatus } = req.body
    if (!attentionStatus) {
      return fansmiddleware.delAttention(req, res, next)
    }
    next()
  },
  fansmiddleware.setAttentionStatus
)

module.exports = router
